home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
prog
/
asm_n_z.arj
/
START.DOC
< prev
next >
Wrap
Text File
|
1988-02-10
|
8KB
|
157 lines
Documentation for START.COM
Start runs any program or makes any DOS call at a specified time. If a user
is operating the computer at that time, his process is suspended, everything
including the screen is saved, and the commanded process begins. When the
commanded process is through, everything is restored for the user (including
the screen, cursor position, etc) and the user can resume where he/she was
interrupted.
This program has some limitations since the IBM PC/AT/XT is not a multi task-
ing system. The most obvious limitation is that the user gets interrupted!
The second is that the program being invoked by START can't use all the system
memory. It can only use about 62k. If it attempts to use more, the system will
crash as explained later on.
START.COM gives up all the memory that it "acquired" when it exits so it is
possible to "chain" several START(s). For instance, START could invoke a batch
program who's last line evoked START again.
Usage:
START [hh:mm:ss] [doscommand]
Where: [hh:mm:ss] is the time in 00:00:00 format (no brackets).
[doscommand] is any command (up to 64 characters in length).
Note: A path must exist for the [doscommand]. For instance, the interrupt
could occur when the user is in any directory or subdirectory. If you wish to
run BACKUP.EXE at 1600 hours, and BACKUP.EXE is in the top directory, you must
invoke START with the following command line.
START 16:00:00 \BACKUP
Limitations:
There are NO defaults, and all fields in the [hh:mm:ss] portion must be
filled (8 O'clock is 08:00:00).
24:00:00 does NOT exist! It is 00:00:00.
A copy of COMMAND.COM (with the correct dos version) must exist in the top
directory of the default drive.
The program to be run must not attempt to use more than 64k! If is does,
the system WILL crash! This is because when START.COM is envoked, it acquires
64k from the system. When it runs the program, it relinquishes all except the
bare minimum that it requires to exist. It does this so there is room for
COMMAND.COM and the called program to be loaded. COMMAND.COM is detached from
the rest of the system and doesn't "know" that memory blocks after START.COM
are probably in use by the program that just got interrupted. It will load
the program overlay just after itself. If the program is not too big, there
will be room and everything will be fine. If there is not enough room, the
system will crash when returning to the interrupted program. This could, of
course, be prevented by having START.COM acquire 128k from the system when
it's loaded. Some systems don't have 128k to give up (and still be able to
run another program)! A compomise.
A full understanding of this program and how it works will prevent user's
from having any problems.
How it works:
When START.COM is first loaded it "owns" all the memory in the computer
just like any other .COM program. In order for you to run other programs
after START.COM issues a terminate, but stay resident call to MS-DOS, it
must give up some memory. It does this by keeping 64k and relinquishing the
rest.
START.COM parses the input command string and puts the saved time and the
program to be run in a memory area safe from harm. It also redirects two
interrupt vectors from the system clock. Every "TICK" of the system clock,
which occurs about 18.5 times per second causes a counter to be decremented
so that the system clock is "divided" by 18.5 to produce one-second ticks.
A local "clock" within START.COM (which was set only once when START.COM was
loaded) is incremented at each second, minute, hour, etc. Every time the
seconds count is changed, START.COM checks to see if the internal time
is the same as the commanded time when it was loaded. When the two times
are equal, a lot of very important things are caused to happen.
1./ A flag is set to tell START.COM that the time is up.
2./ A "critical DOS" flag is checked to see if it is safe to interrupt
MS-DOS. If not, the program continues (returns to the interrupted task).
When is is safe to do so, the following things occur.
3./ The user's FLAGS, STACK, and REGISTERS are saved (on a private stack).
4./ The user's entire screen contents are saved (16k...all possible pages
of screen memory). Also the cursor position, type, and background colors.
This is saved in a temporary file called SCREEN.TMP. Unless the system
crashes you probably will never see this file since it is deleted when
the process exits. This file resides in the top directory of the default
disk.
5./ The user's data transfer area (DTA) is saved (in memory).
6./ The user's directory and current disk is saved (in memory).
7./ It is not possible to save the user's type-ahead buffer.
8./ START.COM gives back to the system all but 2k of memory. This is to make
room for COMMAND.COM and the program(s) it might load and execute.
9./ COMMAND.COM is loaded and executes the command string supplied when
START.COM was loaded. This could be .COM .BAT or .EXE files. Also
system calls.
10./ When COMMAND.COM is through, or when a control_C or control_Brk is
entered, it returns to START.COM.
11./ START.COM restores the user's current disk, directory, screen contents,
cursor type, cursor position, data transfer area. It also deletes the
temporary work file SCREEN.TMP
12./ START.COM restores the interrupt vectors to where they pointed before
START.COM was ever loaded.
13./ START.COM gives back to the system ALL memory that it acquired.
(commits suicide).
14./ START.COM restores all the user's registers, stack, and flags.
15./ In it's last moments of existance, START.COM issues an interrupt
return call and the user's program continues from where is was
interrupted.
Since, after the completion of START.COM's duties, it no longer exists,
there is no limitation to the number ot times that is can be invoked except
the available memory when all processes are loaded. Each time START.COM
completes, it gives back 64k of memory to the system pool.
As mentioned START.COM keeps it's own time in it's own private clock. This
is to reduce the amount of CPU time that is uses from the system when it
is resident. START.COM's clock get's set to the system clock ONLY when it
is first loaded. If you reset the system clock, it will have NO effect upon
the time that START.COM is using! START.COM divides the system "tick" by
18.2 to make one-second ticks. It really should divide it by 18.208! This
means that the clock will be off about 1 second in 24 hours.
All input during START.COM's program overlay should come from a FILE (like
a batch file, etc.) No input should come from the system console except
control_C or control_brk. This is to preserve the user's type-ahead buffer
which could be ANYWHERE (and therefore can't be saved and restored).
Another limitation (which I am trying to fix for a future version) is that
one can't make DOS calls when DOS is is command! This is the purpose of
the "critical DOS flag". This is because DOS does not save everything on
a stack, but in certain memory locations (unknown ...since DOS could be
loaded anywhere). If a program should make a DOS call from DOS, the original
return addresses will be lost and replaced with the new ones....a crash will
follow. Therefore...if you are sitting on the C> prompt when the time is
up, nothing will happen! Of course, as soon as you load a program or do a
directory or anything like that, START.COM will take over and do it's duty.
A future version will save EVERYTHING in DOS and restore upon completion
so that it can ignore the critical DOS flag.
RBJ